---
# title: "Divide Opacity"
title: "分割线不透明度"
# description: "Utilities for controlling the opacity borders between elements."
description: "用于控制元素之间的不透明度边框的功能类。"
---

import plugin from 'tailwindcss/lib/plugins/divideOpacity'
import { Variants } from '@/components/Variants'
import { Disabling } from '@/components/Disabling'

export const classes = {
  plugin,
  transformSelector: (selector) => {
    return selector.split('>')[0].trim().replace(/^\./, '').replace(/\\/g, '')
  }
}

<!-- ## Usage -->
## 使用

<!-- Control the opacity of borders between elements using the `divide-opacity-{amount}` utilities. -->
使用 `divide-opacity-{amount}` 功能控制元素之间边框的不透明度。

```html purple
<template preview>
  <div class="divide-y-4 divide-black divide-opacity-25">
    <div class="text-center font-extrabold text-2xl text-purple-600 py-3">1</div>
    <div class="text-center font-extrabold text-2xl text-purple-600 py-3">2</div>
    <div class="text-center font-extrabold text-2xl text-purple-600 py-3">3</div>
  </div>
</template>

<div class="divide-y-4 **divide-black divide-opacity-25**">
  <div>1</div>
  <div>2</div>
  <div>3</div>
</div>
```

<!-- ## Responsive -->
## 响应式

<!-- To control the opacity of borders between elements at a specific breakpoint, add a `{screen}:` prefix to any existing divide opacity utility. For example, use `md:divide-opacity-50` to apply the `divide-opacity-50` utility at only medium screen sizes and above. -->
要在特定的断点处控制元素之间边框的不透明度，请在任何现有的 divide opacity 功能中添加 `{screen}:` 前缀。例如，使用 `md:divide-opacity-50` 来应用 `divide-opacity-50` 功能，只适用于中等尺寸以上的屏幕。

```html
<div class="divide-y-2 divide-blue-500 divide-opacity-75 **md:divide-opacity-50**">
  <!-- ... -->
</div>
```

<!-- For more information about Tailwind's responsive design features, check out the [Responsive Design](/docs/responsive-design) documentation. -->
关于 Tailwind 的响应式设计功能的更多信息，请查看[响应式设计](/docs/responsive-design)文档。

<!-- ## Customizing -->
## 自定义

<!-- To customize the opacity values for all opacity-related utilities at once, use the `opacity` section of your `tailwind.config.js` theme configuration: -->
要一次性自定义所有与不透明度相关的功能类的不透明度值，请使用您的 `tailwind.config.js` 主题配置中的 `opacity` 部分。

```diff-js
  // tailwind.config.js
  module.exports = {
    theme: {
      extend: {
        opacity: {
+         '10': '0.1',
+         '20': '0.2',
+         '95': '0.95',
        }
      }
    }
  }
```

<!-- If you want to customize only the divide opacity utilities, use the `divideOpacity` section: -->
如果您只想自定义 divide opacity 的功能，请使用 `divideOpacity` 部分。

```diff-js
  // tailwind.config.js
  module.exports = {
    theme: {
      extend: {
        divideOpacity: {
+         '10': '0.1',
+         '20': '0.2',
+         '95': '0.95',
        }
      }
    }
  }
```

<!-- Learn more about customizing the default theme in the [theme customization documentation](/docs/theme#customizing-the-default-theme). -->
在[主题定制文档](/docs/theme#-5)中了解更多关于定制默认主题的信息。

<!-- ### Variants -->
### 变体

<Variants plugin="divideOpacity" />

<!-- ### Disabling -->
### 禁用

<Disabling plugin="divideOpacity" />
